package com.xt.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xt.shop.Model.ShopInfo;
import com.xt.shop.mapper.ShopInfoMapper;
import com.xt.shop.mapper.UserInfoMapper;
import com.xt.shop.service.ShopInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.function.Consumer;

/**
 * @author 24862
 * @description 针对表【shop_info】的数据库操作Service实现
 * @createDate 2024-01-08 16:00:10
 */
@Service
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService, IService<ShopInfo> {

    @Resource
    ShopInfoMapper mapper;

    @Resource
    UserInfoMapper userInfoMapper;


    @Override
    public PageInfo<ShopInfo> queryList(int page, int item, String name) {
        PageHelper.startPage(page, item);
        List<ShopInfo> shopInfos = mapper.getAllStateByName(name);
            shopInfos.forEach(el -> el.setUserId(userInfoMapper.selectById(el.getUserId()).getUsername()));
        return new PageInfo<>(shopInfos);

    }

}




